package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

/**
 * 使用当前类测试反射机制
 */
@AutoRunClass
public class Person {

    private  String name = "张三";
    private  int age = 22;
    public Person(){}

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    @AutoRunMethod()
    public void sayHello(){
        System.out.println(name+":"+"hello!");
    }
    @AutoRunMethod(5)
    public void sayGoodBye(){
        System.out.println(name+":"+"GoodBye!");
    }
    public void dosome(String thing,int num){
        for (int i = 0;i<num;i++){
            System.out.println(name+":正在"+thing);
        }

    }
    public void dosome(String thing){
            System.out.println(name+":正在"+thing);
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    private void secret(){
        System.out.println(name+":这是我的私有方法！");
    }
}
